package com.jn.quartz;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import com.jn.util.MailSender;
import com.jn.util.PostVO;

@Component(value="earlyWarningTask")
public class EarlyWarningTask {
	@Autowired
	private JdbcTemplate jdbcTemplate;
	@Autowired
	private MailSender mailSender;
	public void execute(){
		System.out.println("1111111111111111");
//		String sql = "select t.user_no,t.product_name,t.product_id,t.group_cust_name,t.group_cust_manager_name,t.group_cust_manager_tel " +
//				"from sdst_holly_user_tj_report t where t.exit_apply_date like  '%20131211' and t.state = '退订'";		
//		List<Map<String,Object>> list  = (List<Map<String,Object>>)jdbcTemplate.queryForList(sql);
//		if(list.size()>0){
//			StringBuffer sb = new StringBuffer();
//			sb.append("<html><head><head><body>	<table border=1><tr><td>用户号码</td><td>产品名称</td><td>产品编码</td><td>集团客户名称</td><td>集团客户经理</td><td>集团客户经理电话</td></tr>");															
//			
//			for(int i=0;i<list.size();i++){
//				Map map = list.get(i);
//				sb.append("<tr>");
//				sb.append("<td>"+map.get("user_no")+"</td>");
//				sb.append("<td>"+map.get("product_name")+"</td>");
//				sb.append("<td>"+map.get("product_id")+"</td>");
//				sb.append("<td>"+map.get("group_cust_name")+"</td>");
//				sb.append("<td>"+map.get("group_cust_manager_name")+"</td>");
//				sb.append("<td>"+map.get("group_cust_manager_tel")+"</td>");				
//				sb.append("</tr>");
//			}
//			sb.append("</table></body><html>");
//			PostVO post = new PostVO("退订用户列表","525210476@qq.com","cuiyuliang926@163.com",sb.toString());
//			
//			mailSender.send(post);
//		}
		
		
		
	}
}
